<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
<title>添加安全员</title>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery.pagination.js"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="../../js/validata.js"></script>
<script type="text/javascript" src="../../js/alert.js"></script>
<script type="text/javascript" src="../../js/loadSchoolGrade.js"></script>
<script type="text/javascript" src="../../js/jquery-ui/jquery-ui.min.js"></script>
<!-- WdatePicker -->
<script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js" ></script>
<link rel="stylesheet" type="text/css" href="../../js/jquery-ui/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.css">
</head>
<body>
	<div class="right_mainH4">
		<p>
			添加安全员 <small>Control panel</small>
		</p>
	</div>
	<div>
		<form id="form1">
			<table class="table table-bordered .table-condensed">
				<tr>
					<td>编号:</td>
					<td></td>
					<td></td>
					<td></td>
					<td rowspan="12" id="simg">
						<div class="userface" id="touxiang" onclick="uploadTouxiang();"><span>上传头像</span></div>
						<input type="hidden" name="photoImg" />
					</td>
				</tr>
				<tr>
					<td>培训机构:</td>
					<td id="schools">
					</td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>姓名:</td>
					<td>						 
						<input type="text" name="name" id="updateStudent.name" class="required maxlength:15" />
					</td>
					<td>性别:</td>
					<td>
						<select name="sex" id="sex" style="width: 90px;">
							<option value="1">男</option>
							<option value="2">女</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>身份证号:</td>
					<td>
						<input type="text" name="idcard" class="required conlength:18" />
					</td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>政治面貌:</td>
					<td>
						<select name="politicStatus" style="width: 90px;">
							<option value="1">群众</option>
							<option value="2">共青团员</option>
							<option value="3">中共党员</option>
							<option value="4">民主党派成员</option>
						</select>
					</td>
					<td>文化程度:</td>
					<td>
						<select name="degree" style="width: 90px;">
							<option value="高中">高中</option>
							<option value="文盲">文盲</option>
							<option value="小学">小学</option>
							<option value="初中">初中</option>
							<option value="大专">大专</option>
							<option value="本科">本科</option>
							<option value="硕士">硕士</option>
							<option value="博士">博士</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>资格等级:</td>
					<td>
						<select name="occupationlevel" id="occupationlevel" style="width: 90px;">
							<option value="1">一级</option>
							<option value="2">二级</option>
							<option value="3">三级</option>
							<option value="4">四级</option>
						</select>
					</td>
					<td>驾驶证初领日期:</td>
					<td>
						<input type="text" name="fstdrilicdate" onClick="WdatePicker();"  class="required date" />
					</td>
				</tr>
				<tr>
					<td>准驾车型:</td>
					<td>
						<select name="dripermitted" style="width: 90px;">
							<option value="A1">A1</option>
							<option value="A2">A2</option>
							<option value="A3">A3</option>
							<option value="B1">B1</option>
							<option value="B2">B2</option>
							<option value="C1">C1</option>
							<option value="C2">C2</option>
							<option value="C3">C3</option>
							<option value="C4">C4</option>
							<option value="D">D</option>
							<option value="E">E</option>
							<option value="F">F</option>
							<option value="N">N</option>
							<option value="P">P</option>
						</select>
					</td>
					<td>准教车型:</td>
					<td>
						<select name="teachpermitted" style="width: 90px;">
							<option value="A1">A1</option>
							<option value="A2">A2</option>
							<option value="A3">A3</option>
							<option value="B1">B1</option>
							<option value="B2">B2</option>
							<option value="C1">C1</option>
							<option value="C2">C2</option>
							<option value="C3">C3</option>
							<option value="C4">C4</option>
							<option value="D">D</option>
							<option value="E">E</option>
							<option value="F">F</option>
							<option value="N">N</option>
							<option value="P">P</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>驾驶证号:</td>
					<td>
						<input type="text" name="drilicence" class="required maxlength:25" />
					</td>
					<td>资格证号:</td>
					<td>
						<input type="text" name="occupationno" class="required maxlength:25"/>
					</td>
				</tr>
				<tr>
					<td>住址:</td>
					<td>
						<input type="text" name="address" class="required maxlength:150" />
					</td>
					<td>手机号:</td>
					<td>
						<input type="text" name="mobile" class="required phone" />
					</td>
				</tr>
				<tr>
					<td>状态:</td>
					<td>
						<select name="employstatus" style="width: 90px;">
							<option value="0">在职</option>
							<option value="1">离职</option>
						</select>
					</td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>入职日期:</td>
					<td>
						<input type="text" name="hiredate" onClick="WdatePicker();"  class="required date"/>
					</td>
					<td>离职日期:</td>
					<td>
						<input type="text" name="leavedate" onClick="WdatePicker();"  />
					</td>
				</tr>
				<tr>
					<td>备注:</td>
					<td>
						<input type="text" name="remark" />
					</td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td colspan="5" style="text-align: center;">
						<button type="button" onclick="addSafetyPer();" class="btn btn-info">添加</button>
					</td>
				</tr>
			</table>
		</form>
	</div>
	
     <!-- 上传学员头像 -->
     <div id="uploadImgDiv" style="display:none;" title="头像上传">
     	<iframe src="" style="width:100%;height: 100%" frameborder="no" marginwidth="0" marginheight="0" allowtransparency="yes"></iframe>
     </div>
     
    <script type="text/javascript">
		$(function(){
			var storage = window.sessionStorage;
		    var schools = storage.getItem("schools");//获取存在sessionStorage里的驾校数据
		    if(schools != null){
		    	var schoolHtml;
		    	schoolHtml = '<select name="addSafetyPer.school" id="school" class="required" style="width: 160px;">';
		    	schoolHtml += schools;
		    	schoolHtml += '</select>';
		    	$("#schools").html(schoolHtml);
		    }
		});
		
    	//添加安全员信息
    	function addSafetyPer(){
    		var photoImg = $("input[name='photoImg']").val();
    		if(!isNull(photoImg)){
    			sAlert("请上传照片!");	
    			return;
    		}
    		if(validata("form1")){
        		$.ajax({
        			url : "../../safetyPer/add.ao",
        			type : 'POST',
        			data :$("#form1").serialize(),
        			cache : false,
        			beforeSend : ajaxstar,
        			complete : ajaxend,
        			dataType : "json",
        			success : function(data) {
    					sAlert(data["result"]);
        				if(data["state"] == "success"){
        					clearTable("form1");
        				}
        			}
        		});
    		}
    	}
    	
    	//上传学员头像
    	function uploadTouxiang(){
			$("#uploadImgDiv").find("iframe").attr("src","../upload/touxiangUpload.html?case=1");
			$("#uploadImgDiv").dialog({
				title : "头像上传",
				resizable : false,
				width : 850,
				height : 600,
				resizable : true,
				modal : true,
				buttons : {
					"关闭" : function() {
						$(this).dialog("close");
					}
				}
			});
    	}
    	
    	function setImg(path){
    		$("#uploadImgDiv").dialog("close");
    		$("input[name='photoImg']").val(path);
    		$("div[class='userface']").html("<img src='" + pickerProjectAdd + path + "' />");
    	}
    </script>
</body>
</html>